package com.driving.drivingexam.service;

import com.driving.drivingexam.common.entity.Title;
import com.driving.drivingexam.common.entity.User;
import com.driving.drivingexam.mapper.TitleMapper;
import com.driving.drivingexam.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService{

    @Autowired
    UserMapper userMapper;
    TitleMapper titleMapper;

    @Override
    public List<User> queryAllUser() {
        List<User> users = userMapper.selectAll();
        return users;
    }

    @Override
    public void addUser(User user) {
        userMapper.insert(user);
    }

    @Override
    public User showInfo(Integer id) {
        User uu = userMapper.selectByPrimaryKey(id);
        return uu;
    }

    @Override
    public void updateUserDel(User user) {
        userMapper.updateByPrimaryKeySelective(user);
    }

    @Override
    public User selectByName(String username) {

        User user = userMapper.selectByName(username);
        return user;
    }

}
